package vn.com.shoppie.object;

import vn.com.shoppie.sobject.Store;
import android.content.Context;
import android.graphics.drawable.Drawable;

import com.google.android.maps.OverlayItem;

public class ShopOverlayItem extends OverlayItem {
	private OnOverlayTap listener;
	private Store store;
	private Context context;
	private Drawable drawable;

	public ShopOverlayItem(Context context, Store store) {
		this(context, store, null);
	}

	public ShopOverlayItem(Context context, Store store, OnOverlayTap listener) {
		super(store.getLocation(), store.storeName, store.storeAddress);
		this.context = context;
		this.store = store;
		this.listener = listener;
		drawable = store.getDrawable(context);
	}

	public Store getStore() {
		return store;
	}

	public void refreshDrawable(int zoom) {
//		if (zoom > MainActivity.zoom_def && drawable != null) {
//			setMarker(context.getResources().getDrawable(R.drawable.ico_map_flag_red));
//		} else {
//			setMarker(context.getResources().getDrawable(R.drawable.ico_map_flag_red));
//		}
	}

	public void setOnTapListener(OnOverlayTap listener) {
		this.listener = listener;
	}

	public OnOverlayTap getTapListener() {
		return listener;
	}

	public void removeTapListener() {
		this.listener = null;
	}

	public interface OnOverlayTap {
		public void onTap(ShopOverlayItem item);
	}

}
